//    Copyright (C) Kherty.  All rights reserved.
using System.Collections.Generic;
using OpenLS.Spreadsheet.Expressions;

namespace OpenLS.Spreadsheet
{
    class SharedFormulaManager
    {
        readonly Dictionary<SharedExpression, int> _table = new Dictionary<SharedExpression, int>();
        public int Add(SharedExpression sharedExpression)
        {
            int result = _table.Count;
            _table.Add(sharedExpression, result);
            return result;
        }
        public int Get(SharedExpression sharedExpression)
        {
            return _table[sharedExpression];
        }
        public bool Contains(SharedExpression sharedExpression)
        {
            return _table.ContainsKey(sharedExpression);
        }
    }
}
